home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / demos / r-z / twistdemo / aminet / addtoftpgetlist.rexx next >
OS/2 REXX Batch file  |  1995-03-27  |  2KB  |  111 lines

  1. /**
  2.  * $Id$
  3.  *
  4.  *
  5.  * Add to get list 
  6.  * Copyright © 1995 HiSoft Systems. All Rights Reserved.
  7. **/
  8.  
  9. ADDLIB('rexxsupport.library',0,-30,0)
  10.  
  11. OPTIONS RESULTS
  12.  
  13. ADDRESS Twist
  14. PARSE ARG dbfilename,rela_x,rela_y,shiftkeys
  15. OPEN dbfilename
  16.  
  17. DBLENGTH = LENGTH(dbfilename)
  18.  
  19. do n = 1 to DBLENGTH by 1
  20. X = right(dbfilename,n)
  21. Y = Substr(X,1,1)
  22. IF Y = "/" then do
  23. FTPDBLOCATION = left(dbfilename,DBLENGTH-n) || '/AminetSites.DB'
  24. n = DBLENGTH
  25. END
  26. end
  27.  
  28.  
  29. GETDBFORMFIELD "FileName"
  30. ARCHIVENAME = result
  31.  
  32. GETDBFORMFIELD "Dir"
  33. ARCHIVEDIR = result
  34.  
  35. GETDBFORMFIELD "FTP_BBS"
  36. FTPSITE = result
  37.  
  38. IF FTPSITE = "" then 
  39.  
  40.     do
  41.  
  42.         IF exists('ENV:LastAminetFTP') = 1 then 
  43.  
  44.             do
  45.     
  46.                 Open(input, 'ENV:LastAminetFTP', R)
  47.                 FTPSITE = Readln(input)
  48.                 Close(input)
  49.             END
  50.  
  51.         ELSE 
  52.  
  53.             do
  54.  
  55.                 EXIT
  56.             END
  57.             
  58.     END
  59.             
  60.     ELSE 
  61.  
  62.         do 
  63.  
  64.             Open(output,'ENVARC:LastAminetFTP',W)
  65.             Writeln(output,FTPSITE)
  66.             Close(output)
  67.             Open(output,'ENV:LastAminetFTP',W)
  68.             Writeln(output,FTPSITE)
  69.             Close(output)
  70.         END
  71.  
  72.  
  73. OPEN FTPDBLOCATION
  74.    'SELECTALL WHERE "FTP_Name == \"' || FTPSITE ||'\""',
  75.         'STEM FTPPATH'
  76.  
  77. FTPSITEPATH = FTPPATH.Aminet_Path
  78.  
  79.  
  80. FTPFILEPATH = 'ftp://' || FTPSITE || '/' || FTPSITEPATH || ARCHIVEDIR || '/' || ARCHIVENAME
  81.  
  82. IF exists('ENVARC:AminetFTPGetList') = 1 then 
  83.     do
  84.         Open(output,'ENVARC:AminetFTPGetList',A)
  85.         Writeln(output,FTPFILEPATH)
  86.         Close(output)
  87.         Open(output,'ENV:AminetFTPGetList',A)
  88.         Writeln(output,FTPFILEPATH)
  89.         Close(output)
  90.  
  91.     END
  92.  
  93.     ELSE
  94.  
  95.     DO
  96.         Open(output,'ENVARC:AminetFTPGetList',W)
  97.         Writeln(output,FTPFILEPATH)
  98.         Close(output)
  99.         Open(output,'ENV:AminetFTPGetList',W)
  100.         Writeln(output,FTPFILEPATH)
  101.         Close(output)
  102.     END
  103.  
  104. Open(input,'ENV:AminetFTPGetList',R)
  105. FTPDATA = Readch(input,4096)
  106. Close(input)
  107. IF Exists('ENV:AminetFTPGetList') = 1 then
  108. DO
  109. ADDRESS COMMAND 'sort ENV:AminetFTPGetList ENV:SortedAminetFTPGetList'
  110. ADDRESS COMMAND 'sort ENVARC:AminetFTPGetList ENVARC:SortedAminetFTPGetList'
  111. END